<include file="public@header"/>

<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Student/index')}">学生列表</a></li>
        <li class="active"><a href="{:url('Student/edit')}">编辑学生</a></li>
    </ul>
    <div class="row margin-top-20">
        <div class="col-md-10 col-md-offset-2">
            <form action="{:url('Student/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
                <input type="hidden" name="id" id="id" value="{$data->id}">
                <div class="row">
                    <div class="col-md-9">
                        <table class="table table-bordered chase_classroom_table">
                            <tr>
                                <th>学号<span class="form-required">*</span></th>
                                <td>
                                    <input type="text" class="form-control" name="code" value="{$data->code}" readonly>
                                </td>
                            </tr>
                            <tr>
                                <th>姓名<span class="form-required">*</span></th>
                                <td>
                                    <input type="text" class="form-control" name="name" placeholder="请输入学生姓名" value="{$data->name}">
                                </td>
                            </tr>
                            <tr>
                                <th>性别<span class="form-required">*</span></th>
                                <td>
                                    <div class="col-md-4" style="padding-left: 0px;">
                                        <select class="form-control" name="gender">
                                            <if condition="$data.gender eq 1">
                                                <option value='0'>保密</option>
                                                <option value='1' selected>男</option>
                                                <option value='2'>女</option>
                                            <elseif condition="$data.gender eq 2"/>
                                                <option value='0'>保密</option>
                                                <option value='1'>男</option>
                                                <option value='2' selected>女</option>
                                            <else/>
                                                <option value='0' selected>保密</option>
                                                <option value='1'>男</option>
                                                <option value='2'>女</option>
                                            </if>
                                        </select>
                                    </div>
                                </td>
                            </tr>

                            <tr>
                                <th>年级</th>
                                <td>
                                    <div class="col-md-4" style="padding-left: 0px;">
                                        <select name="grade" class='form-control' id="">
                                        <if condition="$data.grade eq 1">
                                            <option value="1" selected>一年级</option>
                                            <else/>
                                            <option value="1" >一年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 2">
                                            <option value="2" selected>二年级</option>
                                            <else/>
                                            <option value="2" >二年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 3">
                                            <option value="3" selected>三年级</option>
                                            <else/>
                                            <option value="3" >三年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 4">
                                            <option value="4" selected>四年级</option>
                                            <else/>
                                            <option value="4" >四年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 5">
                                            <option value="5" selected>五年级</option>
                                            <else/>
                                            <option value="5" >五年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 6">
                                            <option value="6" selected>六年级</option>
                                            <else/>
                                            <option value="6" >六年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 7">
                                            <option value="7" selected>七年级</option>
                                            <else/>
                                            <option value="7" >七年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 8">
                                            <option value="8" selected>八年级</option>
                                            <else/>
                                            <option value="8" >八年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 9">
                                            <option value="9" selected>九年级</option>
                                            <else/>
                                            <option value="9" >九年级</option>
                                        </if>
                                        <if  condition="$data.grade eq 10">
                                            <option value="10" selected>高一</option>
                                            <else/>
                                            <option value="10" >高一</option>
                                        </if>
                                        <if  condition="$data.grade eq 11">
                                            <option value="11" selected>高二</option>
                                            <else/>
                                            <option value="11" >高二</option>
                                        </if>
                                        <if  condition="$data.grade eq 12">
                                            <option value="12" selected>高三</option>
                                            <else/>
                                            <option value="12" >高三</option>
                                        </if>
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>生日</th>
                                <td>
                                    <div class="col-md-4" style="padding-left: 0px;">
                                        <if condition="!empty($data.birthday)">
                                            <input type="text" class="form-control" name="birthday" placeholder="请输入生日"
                                                   value="{:date('Y-m-d',$data.birthday)}" autocomplete="off" >
                                        <else/>
                                            <input type="text" class="form-control" name="birthday" placeholder="请输入生日"
                                                   value="" autocomplete="off" >
                                        </if>

                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>所在学校</th>
                                <td>
                                    <input type="text" class="form-control" name="school_name" placeholder="请输入学校名称" value="{$data->school_name}">
                                </td>
                            </tr>
                            <tr>
                                <th>家长手机号<span class="form-required">*</span></th>
                                <td>
                                    <input type="text" class="form-control" name="mobile" id="show_mobile" placeholder="请输入家长手机号" value="{$data->mobile}">
                                    <input type="hidden" class="form-control" name="pid" id="hidden_mobile" value="{$data->u_id}">
                                </td>
                            </tr>
                            <tr>
                                <th>联系地址<span class="form-required">*</span></th>
                                <td>
                                    <input type="text" class="form-control" name="address" placeholder="请输入联系地址" value="{$data->address}">
                                </td>
                            </tr>
                        </table>

                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                                <a class="btn btn-default" href="{:url('Student/index')}">{:lang('BACK')}</a>
                            </div>
                        </div>
                    </div>
                </div>
            </form>

        </div>
    </div>
</div>
<!--ajax layer 弹窗-->
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/jquery.autocomplete.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $('input[name="birthday"]').datepicker({
//            changeMonth: true,
            changeYear: true
        });//日期

        //自动补全
        var url = "{:url('Student/ajaxUser')}";
        $('#show_mobile').devbridgeAutocomplete({
            serviceUrl: url,
            autoSelectFirst: true,
            minChars: 1,
            showNoSuggestionNotice: true,
            onSelect: function (suggestion) {
                //设置ID
                $('#hidden_mobile').val(suggestion.data);
            }
        });

    });

</script>

</body>
